<?php
/**
 * Created by PhpStorm.
 * User: caoguangyang
 * Date: 2023-01-22
 * Time: 19:59
 */

namespace App\Services;


use App\Models\SearchHistory;

class SearchHistoryServices extends BaseServices
{
    /**
     * 保存历史记录
     * @param $userId
     * @param $keyword
     * @param $from
     * @return SearchHistory
     */
    public function saveHistory($userId, $keyword, $from) {
        $history = new SearchHistory();
        $history->fill([
            'user_id' => $userId,
            'keyword' => $keyword,
            'from' => $from
        ]);
        $history->save();
        return $history;
    }
}